﻿
using System; 
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp4
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("----------欢 迎 进 入 游 戏 世 界----------");
            Console.WriteLine("*************************");
            Console.WriteLine("**********猜拳，开始**********");
            Console.WriteLine("*************************");
            Console.WriteLine("出拳规则:1.剪刀  2.石头  3.布");
            Player player = UserName();
            System NPC = Begin();
            bool choose = Choose();
            if (!choose)
            {
                Console.WriteLine("退出");
                return;
            }
            else
            {
                Console.WriteLine(player.Name + "   VS   " + NPC.Name + "   对战");
            }
            Game g = new Game();
            bool result = g.Gaming(player, NPC);
            if (!result)
            {
                Console.WriteLine("退出程序");
                return;
            }
            Console.ReadKey();
        }
        public static bool Choose() 
        {
            while (true)
            {
                Console.WriteLine("开始游戏吗？<y/n>");
                string choose = Console.ReadLine();
                switch (choose)
                {
                    case "y":
                        return true;
                    case "n":
                        return false;
                    default:
                        continue;
                }
            }
            
        }
        public static Player UserName()
        {
            Console.WriteLine("请输入您的姓名:");
            string username = Console.ReadLine();
            return new Player(username);
        }
        public static System Begin() 
        {
            while (true)
            {
                Console.WriteLine("请选择对方角色<1.刘备  2.孙权  3.曹操>");
                int NPC = int.Parse(Console.ReadLine());
                switch (NPC)
                {
                    case 1:
                        return new System("刘备");
                    case 2:
                        return new System("孙权");
                    case 3:
                        return new System("曹操");
                    default:
                        Console.WriteLine("请按上述数字所表示内容输入");
                        continue;
                }
            }
        }
    }
}
